<?php
  require_once('inc_admin.php');
  //连接数据库 
  connect();
  //使用$_POST数组获取表单中输入的数据
  $id = $_POST['id'];

if(!empty($_FILES["pic"]["name"])){
    $pic = uploadfile('pic',UserPhotoPath,array('jpg','gif','png'));
  }
  else{
    $pic='';
  }

  $data = array(
    'videoname' => trim($_POST['videoname']),
    'tid' => trim($_POST['tid']),
    'pic' => $pic,
    'intro' => trim($_POST['intro']),
    'uploaddate' => trim($_POST['uploaddate']),
    'uploadadmin' => trim($_POST['uploadadmin'])

    );


  $result = update('videos',$data,'vid='.$id);
  
  if(!$result){
    echo "更新失败！<br/>";
    echo "<a href='videoEdit-From.php?id={$id}'>返回</a>";   
  }else{    
    redirect('video-List.php', '更新成功！');
  }    

 ?>
